package com.epin.common;

/**
 * Created by DELL on 2017/7/27.
 */
public abstract class BaseController {

    /**
     * 成功,返回状态
     * @return
     */
    public AbstractBean success() {
        return new AbstractBean();
    }

    /**
     * 成功,返回状态
     * @return
     */
    public AbstractBean success(Object data) {
        AbstractBean bean = new AbstractBean();
        bean.setData(data);
        return bean;
    }

    /**
     * 失败,返回状态及原因
     * @param message 消息
     * @return
     */
    public AbstractBean fail(String message){
        AbstractBean bean = new AbstractBean();
        bean.setMessage(message);
        bean.setStatus(ResultEnum.ERROR.getVal());
        return bean;
    }


    /**
     * 错误,返回状态及原因
     *
     * @return
     */
    public AbstractBean error() {
        AbstractBean bean = new AbstractBean(ResultEnum.ERROR);
        return bean;
    }


    /**
     *
     * @param result
     * @return
     */
    public AbstractBean prompt(ResultEnum result){
        AbstractBean bean = new AbstractBean(result);
        return bean;
    }
}
